package com.asiainfo.integration.actions;

import com.asiainfo.integration.utils.ConfigProvider;
import org.apache.log4j.Logger;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Usage:
 *
 * @author Charkey
 * @date 2015/11/19
 */
@WebServlet(urlPatterns = "/destination", asyncSupported = true)
public class QueueNameDispatcher extends HttpServlet {

    public static final Logger INFO_LOG = Logger.getLogger(QueueNameDispatcher.class);

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        INFO_LOG.debug("destination dispatcher");

        request.setAttribute("m", request.getParameter("m"));
        request.setAttribute("interface_list", ConfigProvider.getQueueDetailsMap().keySet());

        RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/pages/destinationDecision.jsp");
        dispatcher.forward(request, response);

    }
}
